/**
 * 
 */
package gui.listener;

import gui.GUIMaster;

import java.awt.event.ComponentListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.EventListener;
import java.util.Hashtable;

/**
 * @author Louis
 *
 */
public class InputListenerFactory {

	private Hashtable<Class<? extends EventListener>,InputListener> listeners;
	
	private static InputListenerFactory instance = null;
	
	public static InputListenerFactory getInstance(){
		if(instance == null){
			instance = new InputListenerFactory();
		}
		return instance;
	}
	
	public InputListenerFactory(){
		listeners = new Hashtable<Class<? extends EventListener>, InputListener>();
		listeners.put(MouseListener.class, new MouseInputListener());
		listeners.put(MouseMotionListener.class, new MouseInputListener());
		listeners.put(ComponentListener.class, new MouseInputListener());
	}
	
	public EventListener createInputListener(Class<?> inputDevice, GUIMaster master){
		return listeners.get(inputDevice).create(master);
	}
}
